<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jstl/core"
                xmlns:sf="http://www.springframework.org/tags/faces"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:spring="http://www.springframework.org/tags"
                template="../../../layout/Template.xhtml">

    <ui:define name="menu">
        <ui:include src="${user.menu}"/>
    </ui:define>

    <ui:define name="title">
        <h:outputText value="Liste des enseignants"/>
    </ui:define>
    <ui:define name="content">
        <h:form id="listAttribution">
            <ui:fragment id="listAttributionFragment">
                <h:panelGrid id="readLessonGrid" columns="2">
                    <h:outputText value="#{resourceBundle.readAttributionTeacher} : "/>
                    <h:outputText value="#{flowScope.currentTeacher.login}"/>
                </h:panelGrid>
                <h:messages globalOnly="true"/>

                <rich:dataTable value="#{flowScope.listAttribution}"
                                var="attributionDisplayed" border="1" cellspacing="4" width="100%"
                                id="attributionDataTable" rows="10">
                    <f:facet name="header">
                        <h:outputText value="#{resourceBundle.listUnitFormHeader}"/>
                    </f:facet>

                    <rich:column style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="#{resourceBundle.listAttributionUnitName}"/>
                        </f:facet>
                        <h:outputText value="#{attributionDisplayed.unitName}"/>
                    </rich:column>

                    <rich:column style="text-align:center">
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="#{bundle.listFormAction}">
                                    <a4j:commandButton id="listAttributionCreateButton"
                                                       type="submit" image="/img/add.png" action="addAttribution"
                                                       styleClass="rightButton" rendered="#{not user.student}">
                                        <rich:toolTip value="#{bundle.addButton}" showDelay="600"
                                                      styleClass="tooltipButton"/>
                                    </a4j:commandButton>
                                </h:outputText>
                            </h:panelGroup>
                        </f:facet>

                        <a4j:commandButton action="deleteAttribution" type="submit"
                                           image="/img/delete.png">
                            <rich:toolTip value="#{bundle.deleteButton}" showDelay="600"
                                          styleClass="tooltipButton"/>
                        </a4j:commandButton>
                    </rich:column>
                </rich:dataTable>
            </ui:fragment>
        </h:form>
    </ui:define>
</ui:composition>